package com.ld.security.auth.server.modules.sys.service.impl;

import com.ld.security.auth.server.modules.sys.entity.SysPermission;
import com.ld.security.auth.server.modules.sys.service.ISysPermissionService;

import com.ld.security.common.core.base.po.SuperPo;
import com.ld.security.common.core.base.vo.PageVo;
import com.ld.security.common.mybatis.base.service.*;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.List;

@Service
@Transactional
@CacheConfig(cacheNames = "sysPermissionCache")
class SysPermissionServiceImpl extends ITreeServiceImpl<SysPermission> implements
        ISysPermissionService {


    @Cacheable
    @Override
    public PageVo<SysPermission> page(SuperPo po) {
        return super.page(po);
    }
    @Cacheable
    @Override
    public List<SysPermission> all(SuperPo po) {
        return super.all(po);
    }

    @CacheEvict(allEntries = true)
    @Override
    public int save(SysPermission entity) {
        return super.save(entity);
    }
    @CacheEvict(allEntries = true)
    @Override
    public int saveBatch(Collection<SysPermission> entityList) {
        return super.saveBatch(entityList);
    }

    @CacheEvict(allEntries = true)
    @Override
    public  int remove(SuperPo query) {
        return super.remove(query);
    }
}
